<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--    <button onclick="alert('Hello World!')">点击我</button>-->
<button id="myButton">点击我</button>
<script>
    // var button = document.getElementById('myButton');
    // button.onclick = function (){
    //     alert('Hello World!');
    // }
    var button = document.getElementById('myButton');
    // button.addEventListener('click',function (){
    //     alert('Hello World!')
    // });
    button.addEventListener("click", function () {
        document.getElementById("myButton").innerHTML = "Hello World";
    })
</script>
</body>
</html>